/*     */ package eos.moe.dragoncore.mixins;
/*     */ 
/*     */ import com.google.common.collect.Lists;
/*     */ import java.util.List;
/*     */ import net.minecraft.client.gui.FontRenderer;
/*     */ import net.minecraft.client.gui.GuiUtilRenderComponents;
/*     */ import net.minecraft.util.text.ITextComponent;
/*     */ import net.minecraft.util.text.TextComponentString;
/*     */ import org.spongepowered.asm.mixin.Mixin;
/*     */ import org.spongepowered.asm.mixin.Overwrite;
/*     */ import org.spongepowered.asm.mixin.Shadow;
/*     */ 
/*     */ 
/*     */ @Mixin({GuiUtilRenderComponents.class})
/*     */ public abstract class MixinGuiUtilRenderComponents
/*     */ {
/*     */   @Shadow
/*     */   public static String func_178909_a(String a, boolean bool) {
/*  19 */     return null;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   @Overwrite
/*     */   public static List<ITextComponent> func_178908_a(ITextComponent a, int i, FontRenderer fontRenderer, boolean bool1, boolean bool2) {
/*  28 */     int j = 0;
/*  29 */     TextComponentString textComponentString = new TextComponentString("");
/*  30 */     List<TextComponentString> list = Lists.newArrayList();
/*  31 */     List<ITextComponent> list1 = Lists.newArrayList((Iterable)a);
/*     */     
/*  33 */     for (int k = 0; k < list1.size(); k++) {
/*  34 */       ITextComponent iTextComponent = list1.get(k);
/*  35 */       String str1 = iTextComponent.func_150261_e();
/*  36 */       boolean bool = false;
/*     */ 
/*     */       
/*  39 */       if (str1.contains("\n")) {
/*  40 */         int n = str1.indexOf('\n');
/*  41 */         String str = str1.substring(n + 1);
/*  42 */         str1 = str1.substring(0, n + 1);
/*  43 */         TextComponentString textComponentString2 = new TextComponentString(str);
/*  44 */         textComponentString2.func_150255_a(iTextComponent.func_150256_b().func_150232_l());
/*  45 */         list1.add(k + 1, textComponentString2);
/*  46 */         bool = true;
/*     */       } 
/*     */       
/*  49 */       String str2 = func_178909_a(iTextComponent.func_150256_b().func_150218_j() + str1, bool2);
/*  50 */       String str3 = str2.endsWith("\n") ? str2.substring(0, str2.length() - 1) : str2;
/*     */ 
/*     */       
/*  53 */       int m = fontRenderer.func_78256_a(str3);
/*  54 */       TextComponentString textComponentString1 = new TextComponentString(str3);
/*  55 */       textComponentString1.func_150255_a(iTextComponent.func_150256_b().func_150232_l());
/*     */ 
/*     */       
/*  58 */       if (j + m > i) {
/*     */         
/*  60 */         boolean bool3 = false;
/*     */         
/*  62 */         String str4 = fontRenderer.func_78262_a(str2, i - j, false);
/*  63 */         if (str4.isEmpty() && fontRenderer.func_78256_a(str2.substring(0, 1)) > i) {
/*     */ 
/*     */           
/*  66 */           str4 = str2.substring(0, 1);
/*  67 */           bool3 = true;
/*     */         } 
/*     */         
/*  70 */         String str5 = (str4.length() < str2.length()) ? str2.substring(str4.length()) : null;
/*     */         
/*  72 */         if (str5 != null && !str5.isEmpty()) {
/*     */           
/*  74 */           int n = str4.lastIndexOf(' ');
/*     */           
/*  76 */           if (n >= 0 && fontRenderer.func_78256_a(str2.substring(0, n)) > 0) {
/*  77 */             str4 = str2.substring(0, n);
/*     */             
/*  79 */             if (bool1) {
/*  80 */               n++;
/*     */             }
/*     */             
/*  83 */             str5 = str2.substring(n);
/*  84 */           } else if (j > 0 && !str2.contains(" ")) {
/*  85 */             str4 = "";
/*  86 */             str5 = str2;
/*     */           } 
/*     */           
/*  89 */           str5 = FontRenderer.func_78282_e(str4) + str5;
/*     */           
/*  91 */           TextComponentString textComponentString2 = new TextComponentString(str5);
/*  92 */           textComponentString2.func_150255_a(iTextComponent.func_150256_b().func_150232_l());
/*  93 */           list1.add(k + 1, textComponentString2);
/*     */         } 
/*     */         
/*  96 */         m = fontRenderer.func_78256_a(str4);
/*  97 */         textComponentString1 = new TextComponentString(str4);
/*  98 */         textComponentString1.func_150255_a(iTextComponent.func_150256_b().func_150232_l());
/*  99 */         bool = true;
/*     */         
/* 101 */         if (bool3) {
/*     */           
/* 103 */           if (fontRenderer.func_78256_a(textComponentString.func_150254_d()) > 0) {
/* 104 */             list.add(textComponentString);
/*     */           }
/* 106 */           textComponentString = new TextComponentString("");
/* 107 */           j = m;
/* 108 */           textComponentString.func_150257_a((ITextComponent)textComponentString1);
/*     */           
/*     */           continue;
/*     */         } 
/*     */       } 
/*     */       
/* 114 */       if (j + m <= i) {
/* 115 */         j += m;
/* 116 */         textComponentString.func_150257_a((ITextComponent)textComponentString1);
/*     */       } else {
/* 118 */         bool = true;
/*     */       } 
/*     */       
/* 121 */       if (bool) {
/* 122 */         list.add(textComponentString);
/* 123 */         j = 0;
/* 124 */         textComponentString = new TextComponentString("");
/*     */       } 
/*     */       continue;
/*     */     } 
/* 128 */     list.add(textComponentString);
/* 129 */     return (List)list;
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\mixins\MixinGuiUtilRenderComponents.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */